package jk.zmn.socket.tcp.demo1;

import java.io.*;
import java.net.Socket;
import java.util.Scanner;

/**
 * @author 张梦楠
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2018/5/3116:53
 * @blog www.itzmn.com
 */
public class ClientDemo1 {
     public static void main(String[] args) throws Exception{

         Socket socket = new Socket("localhost", 8888);


         DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());
         String s = dataInputStream.readUTF();
         System.out.println(s);


         DataOutputStream dataOutputStream = new DataOutputStream(socket.getOutputStream());
         dataOutputStream.writeUTF("我是张三，您好服务端");
         dataOutputStream.flush();


     }
}
